package com.guoxin.artconcurrency.chapter7;

import java.util.concurrent.atomic.AtomicInteger;

/**
 * @author guoxin
 * @date 2019/8/6
 */
public class AtomicIntegerTest {

    public static void main(String[] args) {
        AtomicInteger ai = new AtomicInteger(10);
        int andSet = ai.getAndSet(2);
        System.out.println(andSet);
        int i = ai.addAndGet(5);
        System.out.println(i);
        int i1 = ai.incrementAndGet();
        System.out.println(i1);
    }

    public void test(){
    }
}
